package com.egao.common.module.world.vo;

import cn.hutool.core.date.DatePattern;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.util.Date;

/**
 * 济世杯公开信息VO
 * @author root
 */
@Data
public class WorldGamePubliclyVO  {

    @ApiModelProperty("主键编号")
    private Integer id;

    @ApiModelProperty("承办人用户id")
    private Integer userId;

    @ApiModelProperty("封面图")
    private String imgUrl;

    @ApiModelProperty("承办人姓名")
    private String name;

    @ApiModelProperty("标题")
    private String title;

    @ApiModelProperty("举办地点")
    private String address;

    @ApiModelProperty("开始时间")
    @JsonFormat(pattern = DatePattern.NORM_DATETIME_MINUTE_PATTERN)
    private Date startTime;

    @ApiModelProperty(value = "是否过期", notes = "true是 false否")
    private Boolean overdue;

    public Boolean getOverdue() {
        // 开始时间为空 默认过期
        if (null == startTime) {
            return true;
        }

        if (System.currentTimeMillis() >= startTime.getTime()) {
            return true;
        }
        return false;
    }
}
